<!DOCTYPE html>
@extends('layouts.master3')
@section('css')
<style>
.dark-theme .ellipse{
    background: #555;
    background: -moz-linear-gradient(top, #555 0%, #333 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#555), color-stop(100%,#333));
    background: -webkit-linear-gradient(top, #555 0%,#333 100%);
    background: -o-linear-gradient(top, #555 0%,#333 100%);
    background: -ms-linear-gradient(top, #555 0%,#333 100%);
    background: linear-gradient(top, #555 0%,#333 100%);
	}
  i.iconfont{
    font-size: 18px;
    display: inline-block;
    margin-right: 3px;
  }
</style>
@endsection
@section('title')
{{"千里码-排行榜"}}
@stop
@section('content')

<div class="contain">
<div class="row">
<div style="width: 900px;margin: 0 auto;">
  <h2>排行榜</h2>
        <form class="form-inline" action="">
            <div class="form-group form-group-sm">
                <label for="inputName">用户名:</label>
                <input class="form-control input-sm" id="inputName" type="text" name="name" value="{{$name or ''}}">
            </div>
            <button class="btn btn-default btn-sm" type="submit">搜索</button>
        </form>
  <table class="table table-responsive">
    <thead>
      <tr>
        <th class="col-md-2">排名</th>
        <th class="col-md-3">用户名</th>
        <th class="col-md-3">徽章成就</th>
        <th class="col-md-2">解题数</th>
        <th class="col-md-2">分数</th>
      </tr>
    </thead>
    <tbody>
<?php
use App\Utils;
$sc=($page-1)*20;
foreach($userlist as $u)
{
	$sc++;
	$url=$u->avatar->url('thumb');
?>
      <tr <?php if(Auth::check()&&$u->id==Auth::user()->id)echo 'class="success"';?>>
        <td>{{$sc}}</td>
        <td><a target="_blank" href="/profile/{{Utils::id2url($u->id)}}" class="username"><img style="max-width:100px; margin-top: -20px;margin-bottom: -15px;margin-right:5px;" src="{{$url}}" class="img-circle" alt="Cinque Terre" width="30" height="30">{{$u->name}}</a></td>
	<td>
<?php
  if(count($u['medals'])>0) {
	foreach($u['medals'] as $medal){
echo '<i class="iconfont have" title="'.$medal->title.'">'.$medal->class.'</i>';
	}
  }
?>

</td>
        <td>{{$u->solveNum}}</td>
        <td>{{$u->score/100}}</td>
      </tr>
<?Php
$pres=$u->score;
}
?>
    </tbody>
  </table>
<div style="text-align:center">
<?php echo $userlist->appends(['name'=>$name])->render();?>
</div>
</div>
</div>
</div>

@stop
